package com.sunyard.wx.demo.controller;

import com.alibaba.fastjson.JSON;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Created by xi.w on 2018-04-17.
 */
@Controller
public class BmsOrganController {

    @GetMapping("/")
    public String helloworld(HttpServletRequest request, HttpServletResponse response, Model model){
        model.addAttribute("contextPath", request.getContextPath());
        model.addAttribute("requestParameterMapStr", JSON.toJSON(request.getParameterMap()));
        Cookie[] cookies = request.getCookies();
        model.addAttribute("cookiesStr",JSON.toJSON(cookies));
        return "hello";
    }
}
